<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<link rel="Bookmark" href="/favicon.ico">
	<link rel="Shortcut Icon" href="/favicon.ico" />
	<!--[if lt IE 9]>
	<script type="text/javascript" src="__UU__/lib/html5.js"></script>
	<script type="text/javascript" src="__UU__/lib/respond.min.js"></script>
	<script type="text/javascript" src="__UU__/lib/PIE_IE678.js"></script>
	<![endif]-->
	<link href="__UU__/css/H-ui.min.css" rel="stylesheet" type="text/css" />
	<link href="__UU__/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
	<link href="__UU__/lib/Hui-iconfont/1.0.6/iconfont.css" rel="stylesheet" type="text/css" />
	<link href="__UU__/css/style.css" rel="stylesheet" type="text/css" /> 
	<link rel="stylesheet" type="text/css" href="__UU__/lib/bootstrap-Switch/bootstrapSwitch.css"/>
	<link href="__UU__/lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
	<!--[if IE 6]>
	<script type="text/javascript" src="__UU__/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
	<script>DD_belatedPNG.fix('*');</script>
	<![endif]-->
	<title>活动详细</title>
</head>
<body>
	<div class="pd-20">
		<div id="tab-system" class="HuiTab">
		<form action="__APP__/Activity/save_activity" method="post" class="form form-horizontal" id="">
			<div class="tabBar cl"><span>基础情况</span><span>活动详情</span><span>时间/费用</span><span>购买限制</span></div>
			<div class="tabCon">
				    <input type="hidden" name="id" value="{$va.id}"/>
				    <input type="hidden" name="photo" value="{$va.photo}" id="photohidden"/>
				    <input type="hidden" name="basc_photo" id="fengmian" value="{$va.basc_photo}" />
				    <input type="hidden" name="close" id="closethis" value=""/>
					<div class="row cl">
						<label class="form-label col-2">活动名称：</label>
						<div class="formControls col-10">
							<input type="text" name="name" id="" class="input-text" value="{$va.name}"/>
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-2">活动分类：</label>
						<div class="formControls col-10">
							<span class="select-box">
								<select name="class_id" class="select">
									<volist name="classlist" id="co">
										<option value="{$co.id}" <if condition="$va['class_id'] eq $co['id']">selected="selected"</if>>{$co.name}</option>
									</volist>
								</select>
							</span>
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-2">活动图片：</label>
						<div class="formControls col-10">
							<ul id="fenfd">
							    <if condition="$va.photo neq null">
							    <volist name="va['photolist']" id="vv">
							        <li>
							        <img src="{$vv}" alt="" style="width:120px;">
							        <if condition="$vv eq $va['basc_photo']">
							        <button class="btn btn-danger-outline radius size-MINI fong disabled" type="button">封面</button> 
							        <else/>
							        <button class="btn btn-danger-outline radius size-MINI fong " type="button">设为封面</button> 
							        </if>
							        <button class="btn btn-primary-outline radius size-MINI remove" type="button" data-msg="{$vv}">删除</button>
							        </li>
							    </volist>
							    </if>
							</ul>
							<button type="button" class="btn bnt-small btn-secondary-outline radius" onclick="layer_show('更改logo','__APP__/reuse/uploadimagesfile/type/6/page/1')"> 上传</button>
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-2">短描述：</label>
						<div class="formControls col-10">
							<input type="text" name="small_description" id="" class="input-text" value="{$va.small_description}"/>
						</div>
					</div>
					<!-- <div class="row cl">
						<label class="form-label col-2">组织机构：</label>
						<div class="formControls col-10">
							<input type="text" name="organization" id="" class="input-text" value="{$va.organization}"/>
						</div>
					</div> -->
					<div class="row cl">
						<label class="form-label col-2">活动标签：</label>
						<div class="formControls col-10">
						   <div id="ashow">
								<if condition="$labellist neq null">
								<volist name="labellist" id="ao">
								<span data-bind="{$ao.id}">{$ao.name} <i class="Hui-iconfont "></i></span>
								</volist>
								</if>
							</div>
							<input type="hidden" name="label" id="labeled" value="{$va.label}" />
							<button type="button" id="setLabel" class="btn bnt-small btn-secondary-outline radius"> 选择</button>
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-2">区域 ：</label>
						<div class="formControls col-10">
							<span class="select-box inline">
							<select name="provinceid" id="province" class="select" onchange="selectchange('__APP__/Reuse/selectcity','province','city','__APP__/Reuse/selectcircle')">
							    <option value="">请选择</option>
							    <volist name="list" id="vo">
								<option value="{$vo.id}" <if condition="$va['provinceid'] eq $vo['id']">selected="selected"</if>>{$vo.name}</option>
								</volist>
							</select></span>省
							<span class="select-box inline">
							<select name="cityid" id="city" class="select" onchange="selectchange('__APP__/Reuse/selectcity','city','area','__APP__/Reuse/selectcircle')">
							<if condition="$va.cityid neq null">
							    <option value="{$va.cityid}">{$va.cityname}</option>
							</if>
							</select>
							</span>市
							<span class="select-box inline">
							<select name="areaid" id="area" class="select" onchange="selectcircle('__APP__/Reuse/selectcircle','area')">
							<if condition="$va.areaid neq null">
							    <option value="{$va.areaid}">{$va.areaname}</option>
							</if>
							</select>
							</span>区
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-2">商圈：</label>
						<div class="formControls col-10">
							<span class="select-box inline">
								<select name="circle_id" id="circle_id" class='select'>
								<if condition="$va.circle_id neq null">
								    <option value="{$va.circle_id}">{$va.circlename}</option>
								</if>
								</select>
							</span>
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-2">活动场地：</label>
						<div class="formControls col-10">
							<input type="text" name="place" id="" class="input-text" value="{$va.place}"/>
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-2">活动地址：</label>
						<div class="formControls col-5">
							<input type="text" name="address" id="" class="input-text" value="{$va.address}"/>
						</div>
					</div>
					<div class="row cl">
					    <label class="form-label col-2">坐 标：</label>
					    <div class="formControls col-5">
							东经：
							<input type="text" name="east" id="" class="input-text" style="width: 150px;" value="{$va.east}"/>
						</div>
						<div class="formControls col-5">
							北纬：
							<input type="text" name="north" id="" class="input-text" style="width: 150px;" value="{$va.north}"/>
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-2">联系电话：</label>
						<div class="formControls col-10">
							<input type="text" name="phone" id="" class="input-text" value="{$va.phone}"/>
						</div>
					</div>
			</div>
			<div class="tabCon">
					<div class="row cl">
						<label class="form-label col-2">活动介绍：</label>
						<div class="formControls col-10">
							<div>
								<button type="button" class="btn btn-primary radius" id="small-title">插入小标题</button>
								<button type="button" class="btn btn-primary radius" id="thumg" onclick="layer_show('上传图片','__APP__/reuse/uploadimagesfile/type/6/page/2')">插入图片</button>
							</div>
							<div contenteditable="true" class="edit-div mt-20">
								{$va.body}
							</div>
							<input type="hidden" name="body" id="editValue"  value="{$va.body}"/>
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-2">参与须知：</label>
						<div class="formControls col-10">
							<textarea name="apply_notice" class="textarea">{$va.apply_notice}</textarea>
						</div>
					</div>
			</div>
			<div class="tabCon">
					<div class="row cl">
						<label class="form-label col-2">费用类型：</label>
						<div class="formControls col-10 skin-minimal2">
							<div class="radio-box">
					          	<input type="radio" id="fee-1" name="fee_type" checked="checked" value="1">
					          	<label for="fee-1">收费</label>
					        </div>
					        <div class="radio-box">
					          	<input type="radio" id="fee-2" name="fee_type" value="2" <if condition="$va.fee_type eq '2'">checked="checked"</if>>
					          	<label for="fee-2">免费</label>
					        </div>
					        <div class="radio-box">
					          	<input type="radio" id="fee-3" name="fee_type" value="3" <if condition="$va.fee_type eq '3'">checked="checked"</if>>
					          	<label for="fee-3">外链</label>
					        </div>
						</div>
					</div>
					<div class="row wailian" <if condition="$va.fee_type neq '3'">style="display:none"</if>>
						<div class="row cl">
							<label class="form-label col-2">外链地址：</label>
							<div class="formControls col-10">
								<input type="text" name="url" id="" class="input-text" value="{$va.url}"/>
							</div>
						</div>
						<div class="row cl">
							<label class="form-label col-2">活动时间：</label>
							<div class="formControls col-10">
								<input type="text" name="activity_start_date" class="input-text" value="{$va.activity_start_date}"/>
							</div>
						</div>
						<div class="row cl">
							<label class="form-label col-2">活动费用：</label>
							<div class="formControls col-10">
								<input type="text" name="activity_money" class="input-text"  value="{$va.activity_money}"/>
							</div>
						</div>
					</div>
					<div class="row shoufei" <if condition="$va.fee_type eq '3'">style="display:none"</if>>
						<div class="row cl">
							<label class="form-label col-2">退款类型：</label>
							<div class="formControls col-10 skin-minimal">
								<div class="radio-box">
						          	<input type="radio" id="retreat-1" name="retreat_type" checked="checked" value="1">
						          	<label for="retreat-1">可退</label>
						        </div>
						        <div class="radio-box">
						          	<input type="radio" id="retreat-2" name="retreat_type" value="2" <if condition="$va.retreat_type eq '2'">checked="checked"</if>>
						          	<label for="retreat-2">不可退</label>
						        </div>
							</div>
						</div>
						<div class="row cl">
							<label class="form-label col-2">时间类型：</label>
							<div class="formControls col-10">
								<span class="select-box">
									<select name="time_type" id="setype" class="select">
										<option value="">--请选择--</option>
										<option value="1" <if condition="$va.time_type eq '1'">selected="selected"</if>>单个日期</option>
										<option value="2" <if condition="$va.time_type eq '2'">selected="selected"</if>>按周重复</option>
										<option value="3" <if condition="$va.time_type eq '3'">selected="selected"</if>>连续日期</option>
										<option value="4" <if condition="$va.time_type eq '4'">selected="selected"</if>>长期举办</option>
									</select>
								</span>
							</div>
						</div>
						<div class="row cl" id="fd" <if condition="$va.field eq null">style='display: none;'</if>>
							<label class="form-label col-2">&nbsp;</label>
							<div class="formControls col-10">
								<button type="button" class="btn bnt-small btn-secondary-outline radius" onclick="add_chang()">增加场次</button>
							</div>
						</div>
						<div id="session-bar">
							<!--场次-->
							<include file="Reuse:changci" />	
						</div>
					</div>
					
			</div>
			<div class="tabCon">
					<div class="row cl">
						<label class="form-label col-2">&nbsp;</label>
						<div class="formControls col-10 skin-minimal">
							<div class="radio-box">
					          	<input type="radio" id="buy-1" name="buy_limit" value="1" <if condition="$va.buy_limit eq '1' or $va.buy_limit eq null">checked="checked"</if>>
					          	<label for="buy-1">活动结束前均可购买</label>
					        </div> 
					        <br /><br />
					        <div class="radio-box">
					          	<input type="radio" id="buy-2" name="buy_limit" value="2" <if condition="$va.buy_limit eq '2'">checked="checked"</if>>
					          	<label for="buy-2">活动开始前 <input type="text" value="{$va.before_time}" class="input-text" style="width: 50px;" name="before_time" id="" />小时</label>
					        </div>
					        <br /> <br />
					        <div class="radio-box">
					          	<input type="radio" id="buy-3" name="buy_limit" value="3" <if condition="$va.buy_limit eq '3'">checked="checked"</if>>
					          	<label for="buy-3">
					          		指定时间 <input type="text" name="appoint_start_time" id="njd" style="width: 120px;" class="input-text Wdate" onfocus="WdatePicker({minDate:'%y-%M-%d',maxDate:'2110-01-01'})" value="{$va.appoint_start_time}"/>
					          		-
					          		<input type="text" name="appoint_end_time" id="njd2" style="width: 120px;" class="input-text Wdate" onfocus="WdatePicker({minDate:'1990-01-01'})" value="{$va.appoint_end_time}"/>
					          	</label>
					        </div>
						</div>
					</div>
			</div>
			 <div class="row cl">
			    <div class="col-10 col-offset-2">
					<button class="btn btn-danger radius sub" type="button">
						<i class="Hui-iconfont">&#xe632;</i> 存为草稿
					</button>
					<button class="btn btn-primary radius sub" type="button">
						<i class="Hui-iconfont">&#xe632;</i> 提交审核
					</button>
				</div>
			 </div>
			</form>
		</div>
	</div>

<!--  长期举办-->
<script type="text/html" id="se-temp4">

	<div class="session-on">
		<div class="row cl">
			<label class="form-label col-2"><strong>场次{n}&nbsp;&nbsp;</strong></label>
			<div class="formControls col-10">&nbsp;</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-2">活动频率：</label>
			<div class="formControls col-10 skin-minimal">
				<div class="check-box">
					<input type="checkbox" id="week1-{n}" name="week{n}[]" value="1"/>
					<label for="week1-{n}">周一</label>
				</div>
				<div class="check-box">
					<input type="checkbox" id="week2-{n}" name="week{n}[]" value="2"/>
					<label for="week2-{n}">周二</label>
				</div>
				<div class="check-box">
					<input type="checkbox" id="week3-{n}" name="week{n}[]" value="3"/> 
					<label for="week3-{n}">周三</label>
				</div>
				<div class="check-box">
					<input type="checkbox" id="week4-{n}" name="week{n}[]" value="4"/>
					<label for="week4-{n}">周四</label>
				</div>
				<div class="check-box">
					<input type="checkbox" id="week5-{n}" name="week{n}[]" value="5"/>
					<label for="week5-{n}">周五</label>
				</div>
				<div class="check-box">
					<input type="checkbox" id="week6-{n}" name="week{n}[]" value="6" />
					<label for="week6-{n}">周六</label>
				</div>
				<div class="check-box">
					<input type="checkbox" id="week7-{n}" name="week{n}[]" value="0" />
					<label for="week7-{n}">周日</label>
				</div>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-2">活动时间：</label>
			<div class="formControls col-10">
				<input type="text" name="activity_start_time[]" id="logmin-{n}" placeholder="开始时间" class="input-text Wdate" onfocus="WdatePicker({dateFmt:'HH:mm:ss'})" style="width:180px" />
				-
				<input type="text" name="activity_end_time[]" id="logmax-{n}" placeholder="结束时间" class="input-text Wdate" onfocus="WdatePicker({minDate:'01::00::00',dateFmt:'HH:mm:ss'})" style="width:180px" />
			</div>
		</div>
</script>
<!--按周重复-->
<script type="text/html" id="se-temp3">
	<div class="session-on">
		<div class="row cl">
			<label class="form-label col-2"><strong>场次{n}&nbsp;&nbsp;</strong></label>
			<div class="formControls col-10">&nbsp;</div>
		</div>
		<div class="row cl">
			<label class="form-label col-2">活动日期：</label>
			<div class="formControls col-10">
				<input type="text" name="activity_start_date[]" id="mind-{n}" placeholder="开始日期" style="width: 180px" class="input-text Wdate" onfocus="WdatePicker({minDate:'%y-%M-%d',maxDate:'2250-10-01'})" />
				-
				<input type="text" name="activity_end_date[]" id="maxd-{n}" placeholder="结束日期" style="width: 180px" class="input-text Wdate" onfocus="WdatePicker({minDate:'1990-01-01'})" />
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-2">活动频率：</label>
			<div class="formControls col-10 skin-minimal">
				<div class="check-box">
					<input type="checkbox" id="week1-{n}" name="week{n}[]" value="1"/>
					<label for="week1-{n}">周一</label>
				</div>
				<div class="check-box">
					<input type="checkbox" id="week2-{n}" name="week{n}[]" value="2"/>
					<label for="week2-{n}">周二</label>
				</div>
				<div class="check-box">
					<input type="checkbox" id="week3-{n}" name="week{n}[]" value="3"/> 
					<label for="week3-{n}">周三</label>
				</div>
				<div class="check-box">
					<input type="checkbox" id="week4-{n}" name="week{n}[]" value="4"/>
					<label for="week4-{n}">周四</label>
				</div>
				<div class="check-box">
					<input type="checkbox" id="week5-{n}" name="week{n}[]" value="5"/>
					<label for="week5-{n}">周五</label>
				</div>
				<div class="check-box">
					<input type="checkbox" id="week6-{n}" name="week{n}[]"  value="6"/>
					<label for="week6-{n}">周六</label>
				</div>
				<div class="check-box">
					<input type="checkbox" id="week7-{n}" name="week{n}[]"  value="0"/>
					<label for="week7-{n}">周日</label>
				</div>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-2">活动时间：</label>
			<div class="formControls col-10">
				<input type="text" name="activity_start_time[]" id="logmin-{n}" placeholder="开始时间" class="input-text Wdate" onfocus="WdatePicker({dateFmt:'HH:mm:ss'})" style="width:180px" />
				-
				<input type="text" name="activity_end_time[]" id="logmax-{n}" placeholder="结束时间" class="input-text Wdate" onfocus="WdatePicker({minDate:'01::00::00',dateFmt:'HH:mm:ss'})" style="width:180px" />
			</div>
		</div>
</script>
<!--连续日期-->
<script type="text/html" id="se-temp2">
<div class="session-on">
	<div class="row cl">
		<label class="form-label col-2"><strong>场次{n}&nbsp;&nbsp;</strong></label>
		<div class="formControls col-10">&nbsp;</div>
	</div>
	<div class="row cl">
		<label class="form-label col-2">活动日期：</label>
		<div class="formControls col-10">
			<input type="text" name="activity_start_date[]" id="mind-{n}" placeholder="开始日期" style="width: 180px" class="input-text Wdate" onfocus="WdatePicker({minDate:'%y-%M-%d',maxDate:'2555-01-01'})" />
			-
			<input type="text" name="activity_end_date[]" id="maxd-{n}" placeholder="结束日期" style="width: 180px" class="input-text Wdate" onfocus="WdatePicker({minDate:'1990-01-01'})" />
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-2">活动时间：</label>
		<div class="formControls col-10">
			<input type="text" name="activity_start_time[]" id="logmin-{n}" placeholder="开始时间" class="input-text Wdate" onfocus="WdatePicker({dateFmt:'HH:mm:ss'})" style="width:180px" />
			-
			<input type="text" name="activity_end_time[]" id="logmax-{n}" placeholder="结束时间" class="input-text Wdate" onfocus="WdatePicker({minDate:'01::00::00',dateFmt:'HH:mm:ss'})" style="width:180px" />
		</div>
	</div>
</script>
<!--单个日期-->
<script type="text/html" id="se-temp">
<div class="session-on">
	<div class="row cl">
		<label class="form-label col-2"><strong>场次{n}&nbsp;&nbsp;</strong>
		</label>
		<div class="formControls col-10">&nbsp;</div>
	</div>
	<div class="row cl">
		<label class="form-label col-2">活动日期：</label>
		<div class="formControls col-10">
			<input type="text" name="activity_start_date[]" id="" placeholder="开始日期" class="input-text Wdate" onfocus="WdatePicker({minDate:'%y-%M-%d'})" />
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-2">活动时间：</label>
		<div class="formControls col-10">
			<input type="text" name="activity_start_time[]" id="logmin-{n}" placeholder="开始时间" class="input-text Wdate" onfocus="WdatePicker({dateFmt:'HH:mm:ss'})" style="width:180px" />
			-
			<input type="text" name="activity_end_time[]" id="logmax-{n}" placeholder="结束时间" class="input-text Wdate" onfocus="WdatePicker({minDate:'01::00::00',dateFmt:'HH:mm:ss'})" style="width:180px" />
		</div>
	</div>
</script>
<!--票-->
<script type="text/html" id="se-piao">
<div class="row cl">
		<label class="form-label col-2">票价类型：</label>
		<div class="formControls col-10">
			<table class="table table-border table-bordered table-hover table-bg table-sort">
				<thead>
					<tr class="text-c">
						<th width="130px">票名</th>
						<th width="90px">现价</th>
						<th width="90px">原价</th>
						<th width="60px">数量</th>
						<th width="150px">限购</th>
						<th>说明</th>
						<th width="30px">操作</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						
						<td><input type="text" name="ticket_name[]" id="" class="input-text" placeholder="如成人票..." /></td>
						<td><input type="text" name="true_price[]" id="" class="input-text" /></td>
						<td><input type="text" name="old_price[]" id="" value="0" class="input-text" placeholder="没有请填0" /></td>
						<td><input type="text" name="number[]"  class="input-text" /></td>
						<td>
							<input type="text" name="ticket_limit[]" id="" class="input-text" placeholder="单个用户可预订数量" />
						</td>
						<td><input type="text" name="ticket_explain[]" id="" class="input-text" placeholder="针对该价格的说明信息" /></td>
						<td>
							&nbsp;
						</td>
					</tr>
				</tbody>
			</table>
			<div class="text-c mt-20">
				<button type="button" class="btn btn-primary radius" onclick="add_piao(this)">增加票种</button>
			</div>
		</div>
	</div>
</div>
</script>
<script type="text/javascript" src="__UU__/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__UU__/lib/icheck/jquery.icheck.min.js"></script>
<script type="text/javascript" src="__UU__/lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="__UU__/js/H-ui.js"></script>
<script type="text/javascript" src="__UU__/js/H-ui.admin.js"></script>	
<script src="__UU__/lib/bootstrap-Switch/bootstrapSwitch.js"></script>	
<script type="text/javascript" src="__UU__/lib/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="__ADMIN__/js/function.js?w=124444"></script>
<script type="text/javascript">
var chang = 0,vTypd = 0;
var bar = $('#se-piao').html();
function initCheckbox(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
}
layer.config({
    extend: 'extend/layer.ext.js'
});
$(function (){
	initCheckbox();
	$.Huitab("#tab-system .tabBar span","#tab-system .tabCon","current","click","0");

	$('.skin-minimal2 input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	}).change(function (){
		if( this.value == 3 ){
			$('.wailian').show();
			$('.shoufei').hide();
		}else{
			$('.wailian').hide();
			$('.shoufei').show();
		}
	})
	//场次
	$('#setype').change(function (){
		vTypd = parseInt(this.value)
		chang = 1;
		vTypd == 0? ($('#fd').hide()) : ($('#fd').show());
		var temp = switchType(vTypd);
		$('#session-bar').empty();
		$('#session-bar').html( temp + bar );
		initCheckbox();
	});
	$('#small-title').click(function (){
		var l = layer.prompt({
			    title: '输入小标题',
			    formType: 0 //prompt风格，支持0-2
		},function (ds){
			ds && insertDiv('text', ds);
			layer.close(l)
		})
	});


	// 设封面
	$('#fenfd').on('click','.fong',function (){
		if( $(this).hasClass('disabled') ){
			return ;
		}
		$(this).parent().siblings('li').find('.fong').each(function (){
			$(this).removeClass('btn-danger-outline disabled').addClass('btn-primary-outline');
		})
		$(this).removeClass('btn-primary-outline').addClass('btn-danger-outline disabled');
		$('#fengmian').val( $(this).siblings('img').attr('src') );
	});
	//删除
	$('#fenfd').on('click','.remove',function (){
		var photo = $("#photohidden");
		var msg = $(this).attr('data-msg');
		var arr = [];
		photo.val().split(',').forEach(function (item){
			if( item != msg ){
				arr.push(item);
			}
		})
		photo.val(arr.join(','));
		$(this).parent().remove();
		if($('#fengmian').val() == msg){
			var oli = $('#fenfd li').eq(0);
			$('#fengmian').val(oli.find('img').attr('src'));
			oli.find('.fong').removeClass('btn-primary-outline').addClass('btn-danger-outline disabled').text('封面');
			
		}
	});

	//设置标签
	$('#setLabel').click(function (){
		var label = $('#labeled').val();
		if( label == "" ){
			layer_show('设置标签','__APP__/reuse/setlabel');
		}else{
			layer_show('设置标签','__APP__/reuse/setlabel?id=' + label);
		}
	});
	//提交、存草稿
	
  $(".sub").each(function(k){
    $(this).click(function(){
	  layer.confirm('你确定要执行此操作吗？',{
			btn:['确定','取消']
	  },function(){
		  if(k == 0){
			  $("#closethis").val(4)
		  }else{
			  $("#closethis").val(0)
		  }
		  $(".form").submit();
	  })
	});
  });
});
// 保存标签
function interestCallback (data){
	var label = $('#labeled');
	var ashow = $('#ashow');
	var hideValue = "";
	ashow.empty();
	data.forEach(function (item){
		var v = item.split('_');
		hideValue += v[0] + ",";
		ashow.append( '<span data-bind='+v[0]+'>'+v[1]+' <i class="Hui-iconfont ">&#xe6a6;</i></span>' )
	});
	//if( label.val() == '' ){
		label.val(hideValue);
	//}else{
		//label.val( label.val() + hideValue );
	//}
}
//删除某个标签,也删除其ID
$('#ashow').on('click','i',function (){
	var par = $(this).parent();
	var aid = par.attr('data-bind');
	var ahide = $('#labeled').val().split(','),arr = [];
	ahide.forEach(function (item){
		if( aid != item ){
			arr.push(item);
		}
	})
	$('#labeled').val( arr.join(',') );
	par.remove();
});
function appendImg(data){
	var fen = $('#fenfd');
	var fenliLen = fen.find('li').length;
	var str = '<li><img src=' + data.msg + ' alt="" style="width:120px;">' ;
	if( fenliLen < 1 ){
		$("#photohidden").val(data.msg);
		$('#fengmian').val(data.msg);
		str += '<button class="btn btn-danger-outline radius size-MINI fong disabled" type="button">封面</button> '
	}else{
		$("#photohidden").val($("#photohidden").val() + ',' + data.msg);
		str += '<button class="btn btn-primary-outline radius fong size-MINI" type="button">设为封面</button> ';
	}
	str += '<button class="btn btn-primary-outline radius size-MINI remove" type="button" data-msg="'+data.msg+'">删除</button></li>';
	fen.append(str);

}

function upLoadedsCallback (file, res){
	//上传回调
	if(res.code == 200){
		if(res.page == 1){
			appendImg(res)			
		}else if(res.page == 2){
			insertDiv('image',res.msg);
		}
	}else{
		layer.alert(res.msg);
	}
}

function insertDiv (type, content){
	var editDiv = $('.edit-div');
	if( type == 'text' ){
		editDiv.append('<h3>'+content+'</h3>');
	}else if( type == 'image' ){
		var mhtml = '<p><img src="'+content+'"/></p>';
		editDiv.append(mhtml);
	}
	onkeyDiv();
}
function onkeyDiv (){
	var Dom = $('.edit-div');
	
	if( $.trim(Dom.text()) == '' && !(Dom.html().match(/img/g))  ){
		Dom.empty();
	}
	Dom.find(":empty").each(function (){
		if($(this)[0].nodeName.toUpperCase() === 'IMG' ){
			
		}else{
			$(this).remove();
		}
		
	});
	$("#editValue").val(Dom.html());
}

$('.edit-div').keyup(onkeyDiv);



function switchType (v){
	var temp = null;
	switch( v ){
		case 0 :
			$('#session-bar').empty();  //清空，不可见
			 break;
		case 1 :
			temp =$('#se-temp').html();
			break;
		case 2 : 
			temp = $('#se-temp3').html();
			break;
		case 3 : 
			temp = $('#se-temp2').html();
			break;
		case 4 : 
			temp = $('#se-temp4').html();
			break;
		default:
			break;
	}
	return temp.replace(/\{n\}/g,chang);
}
function add_chang (){
	++chang;
	var temp = switchType( vTypd );
	var modeF = $('<div></div>').html( temp + bar );
	$('#session-bar').append( modeF.html() );
	modeF = null;
	initCheckbox();
}
function add_piao (that){
	var sf = '<tr><td><input type="text" name="" id="" class="input-text" placeholder="如成人票..." /></td>';
		sf += '<td><input type="text" name="" id="" class="input-text" /></td><td><input type="text" name="" id="" value="0" class="input-text" /></td><td><input type="text" name=""  id="" class="input-text" /></td>';
		sf += '<td><input type="text" name="" id="" class="input-text" placeholder="单个用户可预订数量" /></td>';
		sf += '<td><input type="text" name="" id="" class="input-text" placeholder="针对该价格的说明信息" /></td><td>';
		sf += '<a title="删除" href="javascript:;" class="ml-5" onclick="del_tr(this)" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a></td></tr>';
	$(that).parent().prev('table').find('tbody').append(sf);
}
function del_tr (that){
	$(that).parents('tr').remove();
}
</script>
</body>
</html>
